﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Pay.Data.Mapping {
    public partial class AuthInfoMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<AuthInfo> {
        public AuthInfoMap() {
            ToTable("mc_AuthInfo", "dbo");

            HasKey(t => t.Id);
            Property(t => t.Id)
                .HasColumnName("Id")
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.MerchantId)
                .HasColumnName("MerchantId")
                .IsRequired();
            Property(t => t.Mobile)
                .HasColumnName("Mobile")
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.BankName)
                .HasColumnName("BankName")
                .HasMaxLength(20)
                .IsOptional();
            Property(t => t.AccountNo)
                .HasColumnName("AccountNo")
                .HasMaxLength(30)
                .IsOptional();
            Property(t => t.AccountName)
                .HasColumnName("AccountName")
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.Type)
                .HasColumnName("Type")
                .IsRequired();
            Property(t => t.Status)
                .HasColumnName("Status")
                .IsRequired();
            Property(t => t.IdCard)
                .HasColumnName("IdCard")
                .HasMaxLength(30)
                .IsOptional();
            Property(t => t.Amount)
                .HasColumnName("Amount")
                .HasPrecision(18, 2)
                .IsRequired();
            Property(t => t.Remark)
                .HasColumnName("Remark")
                .HasMaxLength(500)
                .IsOptional();

            // Relationships
            HasRequired(t => t.Merchant)
                .WithMany()
                .HasForeignKey(d => d.MerchantId)
                .WillCascadeOnDelete(false);
        }
    }
}
